from flask_restful import Resource

from restful.api__.session import admin_required_current_admin_generate
from restful.model.query import QueryMultipleInstances, QueryOneInstance
from restful.model.tables import Role, User
from restful.response import ResponseSuccess


class SystemAllUsersNotAdmin(Resource):
    @admin_required_current_admin_generate
    def get(self,current_admin):
        roles = QueryMultipleInstances(Role,{'admin':False})

        return ResponseSuccess(data=[{
            'uid':i.uid
        }for i in roles])
